package com.java2104.mapper;

import com.java2104.entity.Dept;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface DeptMapper {

    //查询所有部门
    List<Dept> selectDeptName(String name);
    //通过id查找到部门
    @Select("select * from dept_inf where id=#{param1}")
    Dept findByPrimaryKey(Integer id);
    //更新部门的信息
    @Update("update dept_inf set name=#{name},remark=#{remark} where id=#{id}")
    int updateremark(Dept dept);
    //添加用户信息
    @Insert("insert into dept_inf value(null,#{name},#{remark})")
    int insert(Dept dept);
    //通过名字查找
    @Select("select count(*) from dept_inf where name=#{name}")
    int selectname(String name);
    @Select("select count(*) from employee_inf where dept_id=#{id}")
    int selectKey(Integer id);
    @Delete("delete from dept_inf where id=#{param1}")
    int delete(Integer id);
}
